<!--申请售后-->
<div id="customer-service-modal" class="modal fade modal_small" tabindex="1" role="dialog" aria-labelledby="myModalLabel1" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                <h4 class="modal-title">申请售后</h4>
            </div>
            <form action="<?php echo getUrl('order/home/customerService')?>" class="form-horizontal" id="customer-service-form" method="post">
                <div class="modal-body">
                    <div class="form-group">
                        <label class="control-label col-md-2">退款金额<span class="required">*</span></label>
                        <div class="col-md-9">
                            <input class="form-control required number" name="refund_amount" type="tel"/>
                            <span>退款金额最多为：<span class="yuan"></span>（元）</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">售后原因<span class="required">*</span></label>
                        <div class="col-md-9">
                            <textarea name="remark" placeholder="请输入售后原因" rows="3" class="form-control required"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">操作备注<span class="required">*</span></label>
                        <div class="col-md-9">
                            <textarea name="note" placeholder="请输入操作备注" rows="3" class="form-control required"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <input type="hidden" name="order_id" value="<?php echo $info["id"]?>" >
                    <input type="hidden" name="id">
                    <button class="btn default" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> 关闭</button>
                    <button class="btn green field-submit-btn"><i class="fa fa-save"></i> 保存</button>
                    <script type="text/javascript">
                        $(function () {
                            var modal = $("#customer-service-modal");

                            $(".customer-service").live('click',function () {
                                App.blockUI();
                                var id = $(this).parent().attr('data-id');
                                $(this).parent().addClass('service-btn');
                                $(this).parent().prev().addClass('after-sale');
                                modal.find('[name="id"]').val(id);
                                $.ajax('<?php echo getUrl('order/home/getOrderProductInfo')?>', {
                                    dataType:'json',
                                    type:'post',
                                    data:{id:id},
                                    error:function(){
                                        show_message({status:0, message:'请求超时'});
                                        App.unblockUI();
                                    },
                                    timeout:60000,
                                    success:function(data,textStatus,jqXHR){
                                        if (data.status == 0){
                                            show_message(data);
                                            return false;
                                        }
                                        modal.find('.has-error').removeClass('has-error').find('.validate_message').remove();
                                        modal.find('.show_message_error').remove();
                                        modal.find('[name="refund_amount"]').val(data.reality_amount);
                                        modal.find('.yuan').html(data.reality_amount);
                                        modal.modal();
                                        App.unblockUI();
                                    }
                                });
                            });

                            $.e_validate.init('#customer-service-form',{modal:modal,ignore:'',successCallback:function(data){
                                $(".service-btn").find('a').remove();
                                $(".service-btn").removeClass('service-btn');
                                $(".after-sale").html('已申请');
                                $("#data-table").dataTable().fnDraw(true);
                            }});
                        });
                    </script>
                </div>
            </form>
        </div>
    </div>
</div>